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

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

c = A("c")
h = B("h")
l = B("l")
g = B("g")
m = B("m")
f = B("f")
n = B("n")
j = B("j")
i = A("i")

c.q = j
c.v = f
h.x = i
h.u = n
l.x = c
l.u = m
g.x = i
g.u = m
m.x = c
m.u = j
f.x = i
f.u = g
n.x = c
n.u = l
j.x = i
j.u = n
i.q = f
i.v = j
assert i.v.x.q.u.u.u.x.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.v: B = None
        self.txt = txt

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

c = A("c")
h = B("h")
l = B("l")
g = B("g")
m = B("m")
f = B("f")
n = B("n")
j = B("j")
i = A("i")

c.q = j
c.v = f
h.x = i
h.u = n
l.x = c
l.u = m
g.x = i
g.u = m
m.x = c
m.u = j
f.x = i
f.u = g
n.x = c
n.u = l
j.x = i
j.u = n
i.q = f
i.v = j
assert i.v.x.q.u.u.u.x.txt == "i"