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

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

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

h = A("h")
d = B("d")
g = C("g")
k = A("k")
l = C("l")
c = C("c")
a = A("a")

h.y = d
h.x = k
h.t = l
d.y = l
d.z = a
d.t = a
g.t = c
g.y = d
k.y = d
k.x = h
k.t = c
l.t = c
l.y = d
c.t = l
c.y = d
a.y = d
a.x = k
a.t = g
assert k.x.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.x: A = None
        self.t: C = None
        self.txt = txt

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

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

h = A("h")
d = B("d")
g = C("g")
k = A("k")
l = C("l")
c = C("c")
a = A("a")

h.y = d
h.x = k
h.t = l
d.y = l
d.z = a
d.t = a
g.t = c
g.y = d
k.y = d
k.x = h
k.t = c
l.t = c
l.y = d
c.t = l
c.y = d
a.y = d
a.x = k
a.t = g
assert k.x.t.t.t.txt == "l"