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

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

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

c = A("c")
k = B("k")
g = C("g")
j = A("j")
l = A("l")
m = A("m")
f = A("f")
d = A("d")

c.r = g
c.t = g
k.z = g
k.x = g
g.t = k
j.r = g
j.t = g
l.r = g
l.t = g
m.r = g
m.t = g
f.r = g
f.t = g
d.r = g
d.t = g
assert c.r.t.z.t.x.t.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.t: C = None
        self.txt = txt

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

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

c = A("c")
k = B("k")
g = C("g")
j = A("j")
l = A("l")
m = A("m")
f = A("f")
d = A("d")

c.r = g
c.t = g
k.z = g
k.x = g
g.t = k
j.r = g
j.t = g
l.r = g
l.t = g
m.r = g
m.t = g
f.r = g
f.t = g
d.r = g
d.t = g
assert c.r.t.z.t.x.t.z.txt == "g"