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

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

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

f = A("f")
h = B("h")
e = C("e")
c = A("c")
d = C("d")
j = C("j")
m = C("m")
k = C("k")
b = B("b")

f.v = m
f.r = e
f.u = h
h.v = b
e.q = c
e.x = h
c.v = m
c.r = d
c.u = b
d.q = c
d.x = b
j.q = f
j.x = h
m.q = c
m.x = b
k.q = f
k.x = b
b.v = h
assert m.q.u.v.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.r: C = None
        self.u: B = None
        self.txt = txt

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

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

f = A("f")
h = B("h")
e = C("e")
c = A("c")
d = C("d")
j = C("j")
m = C("m")
k = C("k")
b = B("b")

f.v = m
f.r = e
f.u = h
h.v = b
e.q = c
e.x = h
c.v = m
c.r = d
c.u = b
d.q = c
d.x = b
j.q = f
j.x = h
m.q = c
m.x = b
k.q = f
k.x = b
b.v = h
assert m.q.u.v.v.v.txt == "h"