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

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

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

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

j = A("j")
h = B("h")
e = C("e")
l = D("l")
k = C("k")
g = B("g")
c = D("c")
m = A("m")
a = C("a")

j.t = m
h.s = m
e.w = j
e.o = c
l.v = c
l.z = c
l.x = k
l.p = j
k.w = j
k.o = c
g.s = m
c.v = l
c.z = l
c.x = a
c.p = j
m.t = j
a.w = j
a.o = l
assert h.s.t.t.t.t.t.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

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

j = A("j")
h = B("h")
e = C("e")
l = D("l")
k = C("k")
g = B("g")
c = D("c")
m = A("m")
a = C("a")

j.t = m
h.s = m
e.w = j
e.o = c
l.v = c
l.z = c
l.x = k
l.p = j
k.w = j
k.o = c
g.s = m
c.v = l
c.z = l
c.x = a
c.p = j
m.t = j
a.w = j
a.o = l
assert h.s.t.t.t.t.t.t.t.t.txt == "m"