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

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: C = None
        self.y: A = None
        self.q: A = None
        self.p: E = None
        self.txt = txt

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

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

n = A("n")
l = B("l")
a = C("a")
b = D("b")
e = E("e")
d = F("d")
i = B("i")
h = B("h")

n.y = d
l.o = i
l.s = i
a.p = n
a.o = b
a.v = b
b.x = d
b.w = a
b.y = n
b.q = n
b.p = e
e.t = n
d.s = e
i.o = l
i.s = l
h.o = i
h.s = i
assert i.o.s.o.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.x: F = None
        self.w: C = None
        self.y: A = None
        self.q: A = None
        self.p: E = None
        self.txt = txt

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

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

n = A("n")
l = B("l")
a = C("a")
b = D("b")
e = E("e")
d = F("d")
i = B("i")
h = B("h")

n.y = d
l.o = i
l.s = i
a.p = n
a.o = b
a.v = b
b.x = d
b.w = a
b.y = n
b.q = n
b.p = e
e.t = n
d.s = e
i.o = l
i.s = l
h.o = i
h.s = i
assert i.o.s.o.s.s.s.s.txt == "l"