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

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

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

m = A("m")
b = B("b")
e = C("e")
h = B("h")
f = B("f")
j = C("j")
l = A("l")
a = C("a")

m.y = b
m.s = j
m.t = l
b.p = f
b.u = m
e.s = j
e.o = j
e.v = m
h.p = b
h.u = m
f.p = b
f.u = l
j.s = e
j.o = e
j.v = m
l.y = h
l.s = j
l.t = m
a.s = e
a.o = e
a.v = l
assert h.p.u.y.p.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.s: C = None
        self.t: A = None
        self.txt = txt

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

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

m = A("m")
b = B("b")
e = C("e")
h = B("h")
f = B("f")
j = C("j")
l = A("l")
a = C("a")

m.y = b
m.s = j
m.t = l
b.p = f
b.u = m
e.s = j
e.o = j
e.v = m
h.p = b
h.u = m
f.p = b
f.u = l
j.s = e
j.o = e
j.v = m
l.y = h
l.s = j
l.t = m
a.s = e
a.o = e
a.v = l
assert h.p.u.y.p.p.u.txt == "m"