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

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: D = None
        self.r: D = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

g = A("g")
m = B("m")
a = C("a")
l = D("l")
f = E("f")
d = F("d")
j = A("j")
e = F("e")
h = F("h")

g.y = l
g.s = m
m.y = a
m.u = g
m.t = l
m.p = l
a.o = m
l.t = h
f.w = a
f.t = l
f.r = l
f.u = g
d.w = e
j.y = l
j.s = m
e.w = h
h.w = e
assert l.t.w.w.w.w.txt == "
class A:
    def __init__(self, txt: str):
        self.y: D = None
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.w: C = None
        self.t: D = None
        self.r: D = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.w: F = None
        self.txt = txt

g = A("g")
m = B("m")
a = C("a")
l = D("l")
f = E("f")
d = F("d")
j = A("j")
e = F("e")
h = F("h")

g.y = l
g.s = m
m.y = a
m.u = g
m.t = l
m.p = l
a.o = m
l.t = h
f.w = a
f.t = l
f.r = l
f.u = g
d.w = e
j.y = l
j.s = m
e.w = h
h.w = e
assert l.t.w.w.w.w.txt == "h"