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

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

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

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

l.t = j
l.s = d
h.t = j
h.p = c
h.y = g
c.y = j
c.u = h
c.x = h
d.t = h
d.s = l
g.y = j
g.u = j
g.x = j
j.t = h
j.p = c
j.y = c
assert h.t.t.p.y.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: A = None
        self.txt = txt

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

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

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

l.t = j
l.s = d
h.t = j
h.p = c
h.y = g
c.y = j
c.u = h
c.x = h
d.t = h
d.s = l
g.y = j
g.u = j
g.x = j
j.t = h
j.p = c
j.y = c
assert h.t.t.p.y.p.u.txt == "h"