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

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

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

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

i = A("i")
k = B("k")
j = C("j")
c = D("c")
l = D("l")
f = B("f")

i.y = j
i.t = j
k.v = l
k.z = c
k.u = i
j.t = c
c.p = j
l.p = j
f.v = l
f.z = c
f.u = i
assert f.u.t.t.p.t.p.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.t: C = None
        self.txt = txt

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

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

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

i = A("i")
k = B("k")
j = C("j")
c = D("c")
l = D("l")
f = B("f")

i.y = j
i.t = j
k.v = l
k.z = c
k.u = i
j.t = c
c.p = j
l.p = j
f.v = l
f.z = c
f.u = i
assert f.u.t.t.p.t.p.txt == "j"