class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: D = None
        self.q: D = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

b = A("b")
a = B("a")
f = C("f")
m = D("m")
j = D("j")
c = B("c")
i = A("i")
k = A("k")

b.r = c
b.z = m
b.q = j
b.y = f
a.s = c
f.v = b
m.y = j
m.u = j
m.w = f
j.y = m
j.u = m
j.w = f
c.s = a
i.r = a
i.z = m
i.q = m
i.y = f
k.r = a
k.z = j
k.q = m
k.y = f
assert a.s.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: D = None
        self.q: D = None
        self.y: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: B = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.v: A = None
        self.txt = txt

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

b = A("b")
a = B("a")
f = C("f")
m = D("m")
j = D("j")
c = B("c")
i = A("i")
k = A("k")

b.r = c
b.z = m
b.q = j
b.y = f
a.s = c
f.v = b
m.y = j
m.u = j
m.w = f
j.y = m
j.u = m
j.w = f
c.s = a
i.r = a
i.z = m
i.q = m
i.y = f
k.r = a
k.z = j
k.q = m
k.y = f
assert a.s.s.s.s.s.s.txt == "a"