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

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

i.s = h
i.y = a
i.x = d
i.q = n
b.r = l
l.s = e
n.x = c
a.p = e
d.y = m
d.v = a
m.p = e
e.s = l
h.s = i
h.y = a
h.x = d
h.q = n
c.r = e
assert h.x.y.p.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.s: A = None
        self.y: E = None
        self.x: F = None
        self.q: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.p: C = None
        self.txt = txt

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

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

i.s = h
i.y = a
i.x = d
i.q = n
b.r = l
l.s = e
n.x = c
a.p = e
d.y = m
d.v = a
m.p = e
e.s = l
h.s = i
h.y = a
h.x = d
h.q = n
c.r = e
assert h.x.y.p.s.s.s.s.txt == "e"