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

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

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

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

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

i.t = g
i.u = k
i.v = f
g.v = i
f.q = e
f.o = e
k.z = e
k.r = g
k.w = i
k.p = i
e.q = f
e.o = f
assert g.v.v.q.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.u: D = None
        self.v: C = None
        self.txt = txt

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

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

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

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

i.t = g
i.u = k
i.v = f
g.v = i
f.q = e
f.o = e
k.z = e
k.r = g
k.w = i
k.p = i
e.q = f
e.o = f
assert g.v.v.q.o.q.txt == "e"