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

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

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

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

c = A("c")
g = B("g")
h = C("h")
l = D("l")
j = D("j")
f = A("f")
e = B("e")
n = A("n")

c.u = j
c.t = h
g.x = n
h.z = f
l.r = h
l.o = c
l.p = e
j.r = h
j.o = f
j.p = e
f.u = l
f.t = h
e.x = f
n.u = l
n.t = h
assert f.t.z.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: C = None
        self.txt = txt

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

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

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

c = A("c")
g = B("g")
h = C("h")
l = D("l")
j = D("j")
f = A("f")
e = B("e")
n = A("n")

c.u = j
c.t = h
g.x = n
h.z = f
l.r = h
l.o = c
l.p = e
j.r = h
j.o = f
j.p = e
f.u = l
f.t = h
e.x = f
n.u = l
n.t = h
assert f.t.z.u.txt == "l"