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

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

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

j = A("j")
l = B("l")
a = C("a")
k = B("k")
b = B("b")
c = B("c")
g = C("g")
m = A("m")

j.x = m
l.t = a
a.o = j
a.v = c
a.r = g
k.t = g
b.t = g
c.t = a
g.o = j
g.v = l
g.r = a
m.x = j
assert k.t.o.x.x.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.t: C = None
        self.txt = txt

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

j = A("j")
l = B("l")
a = C("a")
k = B("k")
b = B("b")
c = B("c")
g = C("g")
m = A("m")

j.x = m
l.t = a
a.o = j
a.v = c
a.r = g
k.t = g
b.t = g
c.t = a
g.o = j
g.v = l
g.r = a
m.x = j
assert k.t.o.x.x.x.x.x.x.txt == "j"