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

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

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

f = A("f")
d = B("d")
l = C("l")
e = A("e")
c = A("c")
j = B("j")
i = A("i")
g = B("g")
b = A("b")
n = C("n")

f.x = b
d.s = l
l.p = j
l.t = i
l.u = e
e.x = f
c.x = e
j.s = l
i.x = c
g.s = n
b.x = e
n.p = j
n.t = i
n.u = i
assert g.s.p.s.u.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: A = None
        self.txt = txt

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

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

f = A("f")
d = B("d")
l = C("l")
e = A("e")
c = A("c")
j = B("j")
i = A("i")
g = B("g")
b = A("b")
n = C("n")

f.x = b
d.s = l
l.p = j
l.t = i
l.u = e
e.x = f
c.x = e
j.s = l
i.x = c
g.s = n
b.x = e
n.p = j
n.t = i
n.u = i
assert g.s.p.s.u.x.x.x.x.txt == "f"