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

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: D = None
        self.s: A = None
        self.t: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: B = None
        self.txt = txt

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

j.o = f
j.q = k
b.o = e
b.u = f
b.s = j
b.t = j
k.u = e
f.z = h
f.t = b
e.u = h
h.u = k
assert f.t.o.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: C = None
        self.u: D = None
        self.s: A = None
        self.t: A = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: C = None
        self.t: B = None
        self.txt = txt

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

j.o = f
j.q = k
b.o = e
b.u = f
b.s = j
b.t = j
k.u = e
f.z = h
f.t = b
e.u = h
h.u = k
assert f.t.o.u.u.u.txt == "e"