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

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

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

l = A("l")
i = B("i")
k = C("k")
d = A("d")
g = B("g")
e = B("e")
h = C("h")
m = A("m")
n = B("n")
f = B("f")

l.p = m
l.q = d
i.r = k
i.u = h
i.z = l
k.x = h
d.p = m
d.q = m
g.r = k
g.u = h
g.z = l
e.r = k
e.u = k
e.z = d
h.x = k
m.p = l
m.q = l
n.r = k
n.u = k
n.z = m
f.r = h
f.u = h
f.z = m
assert h.x.x.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.q: A = None
        self.txt = txt

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

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

l = A("l")
i = B("i")
k = C("k")
d = A("d")
g = B("g")
e = B("e")
h = C("h")
m = A("m")
n = B("n")
f = B("f")

l.p = m
l.q = d
i.r = k
i.u = h
i.z = l
k.x = h
d.p = m
d.q = m
g.r = k
g.u = h
g.z = l
e.r = k
e.u = k
e.z = d
h.x = k
m.p = l
m.q = l
n.r = k
n.u = k
n.z = m
f.r = h
f.u = h
f.z = m
assert h.x.x.x.x.x.txt == "k"