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

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

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

f = A("f")
h = B("h")
b = C("b")
i = A("i")
l = C("l")
m = B("m")
k = A("k")
n = C("n")
g = B("g")
a = C("a")

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

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

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

f = A("f")
h = B("h")
b = C("b")
i = A("i")
l = C("l")
m = B("m")
k = A("k")
n = C("n")
g = B("g")
a = C("a")

f.v = i
f.p = l
f.u = m
h.x = m
b.u = i
b.q = n
b.p = l
i.v = k
i.p = n
i.u = m
l.u = f
l.q = b
l.p = a
m.x = h
k.v = i
k.p = a
k.u = m
n.u = i
n.q = b
n.p = b
g.x = h
a.u = k
a.q = b
a.p = b
assert f.p.u.v.v.p.u.u.x.txt == "h"