class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: E = None
        self.o: E = None
        self.t: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.z: C = None
        self.y: C = None
        self.t: B = None
        self.txt = txt

f = A("f")
b = B("b")
h = C("h")
j = D("j")
m = E("m")
k = D("k")

f.s = j
f.y = m
f.o = m
f.t = k
b.x = j
h.w = m
h.x = k
j.r = f
j.q = b
m.x = b
m.t = b
m.r = h
m.z = h
m.y = h
k.r = f
k.q = b
assert j.q.x.q.x.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: D = None
        self.y: E = None
        self.o: E = None
        self.t: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.r: C = None
        self.z: C = None
        self.y: C = None
        self.t: B = None
        self.txt = txt

f = A("f")
b = B("b")
h = C("h")
j = D("j")
m = E("m")
k = D("k")

f.s = j
f.y = m
f.o = m
f.t = k
b.x = j
h.w = m
h.x = k
j.r = f
j.q = b
m.x = b
m.t = b
m.r = h
m.z = h
m.y = h
k.r = f
k.q = b
assert j.q.x.q.x.q.txt == "b"