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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: C = None
        self.r: B = None
        self.x: B = None
        self.txt = txt

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

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

m = A("m")
k = B("k")
l = C("l")
h = D("h")
b = B("b")
g = D("g")
a = C("a")

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

class B:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: C = None
        self.r: B = None
        self.x: B = None
        self.txt = txt

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

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

m = A("m")
k = B("k")
l = C("l")
h = D("h")
b = B("b")
g = D("g")
a = C("a")

m.y = a
m.v = b
k.o = g
k.t = l
k.r = b
k.x = b
l.p = a
l.u = a
l.t = m
l.s = m
h.v = k
b.o = h
b.t = a
b.r = k
b.x = k
g.v = k
a.p = l
a.u = l
a.t = m
a.s = m
assert h.v.t.s.v.t.t.txt == "m"