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

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

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

j = A("j")
m = B("m")
h = C("h")
e = C("e")
l = A("l")
b = C("b")
i = A("i")
c = C("c")
d = A("d")
k = C("k")

j.r = i
m.x = c
m.o = j
m.z = k
h.x = i
h.r = e
h.p = m
e.x = l
e.r = b
e.p = m
l.r = d
b.x = i
b.r = h
b.p = m
i.r = j
c.x = j
c.r = e
c.p = m
d.r = i
k.x = l
k.r = h
k.p = m
assert l.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.txt = txt

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

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

j = A("j")
m = B("m")
h = C("h")
e = C("e")
l = A("l")
b = C("b")
i = A("i")
c = C("c")
d = A("d")
k = C("k")

j.r = i
m.x = c
m.o = j
m.z = k
h.x = i
h.r = e
h.p = m
e.x = l
e.r = b
e.p = m
l.r = d
b.x = i
b.r = h
b.p = m
i.r = j
c.x = j
c.r = e
c.p = m
d.r = i
k.x = l
k.r = h
k.p = m
assert l.r.r.r.r.txt == "i"