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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.u: D = None
        self.txt = txt

a = A("a")
k = B("k")
i = C("i")
c = D("c")
b = E("b")
d = C("d")
e = B("e")
f = B("f")
g = D("g")
h = E("h")

a.s = i
k.u = i
k.y = d
k.r = d
k.p = b
i.u = f
c.q = b
b.p = a
b.u = c
d.u = e
e.u = d
e.r = d
e.y = i
e.p = h
f.u = i
f.r = i
f.y = d
f.p = h
g.q = h
h.p = a
h.u = c
assert f.p.u.q.u.q.u.q.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.p: A = None
        self.u: D = None
        self.txt = txt

a = A("a")
k = B("k")
i = C("i")
c = D("c")
b = E("b")
d = C("d")
e = B("e")
f = B("f")
g = D("g")
h = E("h")

a.s = i
k.u = i
k.y = d
k.r = d
k.p = b
i.u = f
c.q = b
b.p = a
b.u = c
d.u = e
e.u = d
e.r = d
e.y = i
e.p = h
f.u = i
f.r = i
f.y = d
f.p = h
g.q = h
h.p = a
h.u = c
assert f.p.u.q.u.q.u.q.txt == "b"