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

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

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

m = A("m")
n = B("n")
l = C("l")
h = B("h")
j = A("j")
g = A("g")

m.p = l
m.u = g
m.v = j
n.q = l
l.r = j
h.q = l
j.p = l
j.u = g
j.v = m
g.p = l
g.u = j
g.v = m
assert m.u.u.v.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: A = None
        self.v: A = None
        self.txt = txt

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

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

m = A("m")
n = B("n")
l = C("l")
h = B("h")
j = A("j")
g = A("g")

m.p = l
m.u = g
m.v = j
n.q = l
l.r = j
h.q = l
j.p = l
j.u = g
j.v = m
g.p = l
g.u = j
g.v = m
assert m.u.u.v.txt == "m"