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

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

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

m = A("m")
d = B("d")
j = C("j")
h = B("h")
k = B("k")
n = A("n")
l = A("l")
f = B("f")
e = A("e")
g = A("g")

m.u = j
d.t = f
d.p = l
d.v = k
j.y = d
h.t = d
h.v = d
h.p = l
k.t = f
k.v = f
k.p = g
n.u = j
l.u = j
f.t = d
f.p = m
f.v = h
e.u = j
g.u = j
assert n.u.y.p.u.y.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

m = A("m")
d = B("d")
j = C("j")
h = B("h")
k = B("k")
n = A("n")
l = A("l")
f = B("f")
e = A("e")
g = A("g")

m.u = j
d.t = f
d.p = l
d.v = k
j.y = d
h.t = d
h.v = d
h.p = l
k.t = f
k.v = f
k.p = g
n.u = j
l.u = j
f.t = d
f.p = m
f.v = h
e.u = j
g.u = j
assert n.u.y.p.u.y.v.v.txt == "f"