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

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

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

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

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

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

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

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

d.u = g
l.o = m
l.v = k
b.x = d
b.q = k
b.w = g
c.u = f
j.x = d
j.q = l
j.w = g
g.u = f
f.u = g
m.x = g
m.q = k
m.w = c
k.o = b
k.v = l
assert g.u.u.u.u.u.u.u.txt == "f"