class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: B = None
        self.r: B = None
        self.txt = txt

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

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

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

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

g.z = k
g.s = e
g.r = e
e.t = f
f.q = d
d.z = e
d.x = e
d.u = k
a.t = f
i.t = f
b.t = f
k.z = g
k.s = i
k.r = a
assert i.t.q.u.r.t.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.z: A = None
        self.s: B = None
        self.r: B = None
        self.txt = txt

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

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

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

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

g.z = k
g.s = e
g.r = e
e.t = f
f.q = d
d.z = e
d.x = e
d.u = k
a.t = f
i.t = f
b.t = f
k.z = g
k.s = i
k.r = a
assert i.t.q.u.r.t.q.u.txt == "k"