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

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

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

e = A("e")
n = B("n")
m = C("m")
c = C("c")
k = C("k")
b = B("b")
g = A("g")
l = A("l")

e.o = n
e.x = b
e.v = b
n.o = m
n.u = c
m.q = n
c.q = b
k.q = b
b.o = k
b.u = m
g.o = b
g.v = b
g.x = n
l.o = n
l.x = n
l.v = n
assert b.u.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.o: B = None
        self.x: B = None
        self.v: B = None
        self.txt = txt

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

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

e = A("e")
n = B("n")
m = C("m")
c = C("c")
k = C("k")
b = B("b")
g = A("g")
l = A("l")

e.o = n
e.x = b
e.v = b
n.o = m
n.u = c
m.q = n
c.q = b
k.q = b
b.o = k
b.u = m
g.o = b
g.v = b
g.x = n
l.o = n
l.x = n
l.v = n
assert b.u.q.u.txt == "c"