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

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

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

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

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

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

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

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

f.o = d
k.t = i
k.q = e
c.v = j
c.p = e
c.x = e
e.t = f
e.q = k
j.v = c
j.p = k
j.x = e
d.o = b
l.o = b
g.o = b
b.o = d
i.o = l
assert f.o.o.o.txt == "d"