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

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

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

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

l = A("l")
f = B("f")
d = C("d")
k = D("k")
e = B("e")
c = A("c")
g = C("g")

l.t = k
f.v = d
f.u = e
d.x = k
d.y = k
d.z = g
k.w = f
k.s = f
k.p = l
k.r = d
e.v = d
e.u = f
c.t = k
g.x = k
g.y = k
g.z = d
assert f.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.txt = txt

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

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

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

l = A("l")
f = B("f")
d = C("d")
k = D("k")
e = B("e")
c = A("c")
g = C("g")

l.t = k
f.v = d
f.u = e
d.x = k
d.y = k
d.z = g
k.w = f
k.s = f
k.p = l
k.r = d
e.v = d
e.u = f
c.t = k
g.x = k
g.y = k
g.z = d
assert f.u.u.u.txt == "e"