class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: B = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: B = None
        self.w: B = None
        self.txt = txt

f = A("f")
c = B("c")
b = C("b")
i = D("i")
g = B("g")
k = D("k")

f.s = k
f.p = g
f.x = i
c.q = b
c.w = f
b.o = k
i.y = k
i.r = g
i.w = g
g.q = b
g.w = f
k.y = i
k.r = g
k.w = g
assert c.w.x.y.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.p: B = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: C = None
        self.w: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: B = None
        self.w: B = None
        self.txt = txt

f = A("f")
c = B("c")
b = C("b")
i = D("i")
g = B("g")
k = D("k")

f.s = k
f.p = g
f.x = i
c.q = b
c.w = f
b.o = k
i.y = k
i.r = g
i.w = g
g.q = b
g.w = f
k.y = i
k.r = g
k.w = g
assert c.w.x.y.r.q.txt == "b"