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

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

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

m = A("m")
l = B("l")
c = C("c")
b = A("b")
k = B("k")
h = C("h")

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

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

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

m = A("m")
l = B("l")
c = C("c")
b = A("b")
k = B("k")
h = C("h")

m.r = k
m.v = l
m.p = b
l.y = k
l.v = b
c.t = h
c.u = h
c.v = h
b.r = l
b.v = l
b.p = m
k.y = l
k.v = b
h.t = c
h.u = c
h.v = c
assert l.y.v.p.v.v.p.txt == "m"