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

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

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

j = A("j")
d = B("d")
l = C("l")
a = A("a")
f = B("f")
c = C("c")
h = A("h")
k = A("k")
b = A("b")

j.t = a
d.x = k
d.o = f
d.w = c
l.v = c
l.o = j
a.t = k
f.x = j
f.o = d
f.w = l
c.v = l
c.o = j
h.t = j
k.t = j
b.t = a
assert b.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

j = A("j")
d = B("d")
l = C("l")
a = A("a")
f = B("f")
c = C("c")
h = A("h")
k = A("k")
b = A("b")

j.t = a
d.x = k
d.o = f
d.w = c
l.v = c
l.o = j
a.t = k
f.x = j
f.o = d
f.w = l
c.v = l
c.o = j
h.t = j
k.t = j
b.t = a
assert b.t.t.t.txt == "j"