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

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

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

i = A("i")
k = B("k")
g = C("g")
c = B("c")
e = A("e")
l = B("l")

i.y = g
k.x = e
k.z = g
k.t = g
g.x = c
g.q = c
g.z = l
c.x = i
c.z = g
c.t = g
e.y = g
l.x = i
l.z = g
l.t = g
assert i.y.x.t.x.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: C = None
        self.txt = txt

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

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

i = A("i")
k = B("k")
g = C("g")
c = B("c")
e = A("e")
l = B("l")

i.y = g
k.x = e
k.z = g
k.t = g
g.x = c
g.q = c
g.z = l
c.x = i
c.z = g
c.t = g
e.y = g
l.x = i
l.z = g
l.t = g
assert i.y.x.t.x.t.txt == "g"