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

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: D = None
        self.v: D = None
        self.q: A = None
        self.t: D = None
        self.txt = txt

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

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

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

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

k.t = m
k.r = c
k.w = f
c.o = e
c.r = n
c.v = d
c.q = l
c.t = h
b.y = c
b.r = h
b.o = l
b.p = e
n.w = f
m.x = c
m.o = e
f.y = c
f.p = c
f.r = d
f.o = l
h.w = b
l.t = m
l.r = e
l.w = f
e.o = c
e.r = n
e.v = n
e.t = n
e.q = l
d.w = b
assert b.p.q.w.r.w.txt == "
class A:
    def __init__(self, txt: str):
        self.t: E = None
        self.r: B = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.r: D = None
        self.v: D = None
        self.q: A = None
        self.t: D = None
        self.txt = txt

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

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

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

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

k.t = m
k.r = c
k.w = f
c.o = e
c.r = n
c.v = d
c.q = l
c.t = h
b.y = c
b.r = h
b.o = l
b.p = e
n.w = f
m.x = c
m.o = e
f.y = c
f.p = c
f.r = d
f.o = l
h.w = b
l.t = m
l.r = e
l.w = f
e.o = c
e.r = n
e.v = n
e.t = n
e.q = l
d.w = b
assert b.p.q.w.r.w.txt == "b"