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

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

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

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

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

i.u = f
i.q = c
f.t = i
f.u = a
k.w = f
a.z = h
a.p = h
a.t = b
j.u = c
j.q = f
h.w = c
b.z = k
b.p = k
b.t = l
c.t = i
c.u = l
l.z = k
l.p = k
l.t = b
assert i.u.u.t.z.w.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

i.u = f
i.q = c
f.t = i
f.u = a
k.w = f
a.z = h
a.p = h
a.t = b
j.u = c
j.q = f
h.w = c
b.z = k
b.p = k
b.t = l
c.t = i
c.u = l
l.z = k
l.p = k
l.t = b
assert i.u.u.t.z.w.t.u.txt == "f"