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

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

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

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

n = A("n")
f = B("f")
h = C("h")
k = D("k")
c = D("c")
b = B("b")
l = A("l")
g = B("g")
d = B("d")
e = A("e")

n.p = b
f.s = b
h.x = c
k.u = h
k.r = h
k.w = f
k.v = c
c.u = h
c.r = h
c.w = g
c.v = k
b.s = f
l.p = f
g.s = f
d.s = g
e.p = f
assert e.p.s.s.s.s.s.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

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

n = A("n")
f = B("f")
h = C("h")
k = D("k")
c = D("c")
b = B("b")
l = A("l")
g = B("g")
d = B("d")
e = A("e")

n.p = b
f.s = b
h.x = c
k.u = h
k.r = h
k.w = f
k.v = c
c.u = h
c.r = h
c.w = g
c.v = k
b.s = f
l.p = f
g.s = f
d.s = g
e.p = f
assert e.p.s.s.s.s.s.txt == "b"