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

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

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

l = A("l")
n = B("n")
m = C("m")
k = B("k")
h = A("h")
i = C("i")

l.t = k
l.r = i
l.v = m
n.u = m
m.y = i
m.p = h
m.v = k
k.u = i
h.t = k
h.r = m
h.v = m
i.y = m
i.p = l
i.v = k
assert i.y.p.t.u.txt == "
class A:
    def __init__(self, txt: str):
        self.t: B = None
        self.r: C = None
        self.v: C = None
        self.txt = txt

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

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

l = A("l")
n = B("n")
m = C("m")
k = B("k")
h = A("h")
i = C("i")

l.t = k
l.r = i
l.v = m
n.u = m
m.y = i
m.p = h
m.v = k
k.u = i
h.t = k
h.r = m
h.v = m
i.y = m
i.p = l
i.v = k
assert i.y.p.t.u.txt == "i"