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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: A = None
        self.s: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: B = None
        self.txt = txt

c = A("c")
k = B("k")
g = C("g")
i = D("i")
h = E("h")
b = C("b")
j = D("j")

c.q = j
c.w = h
k.u = j
k.z = c
k.s = c
g.s = c
g.y = c
g.o = i
i.t = b
i.z = b
i.p = h
i.y = g
h.v = c
h.q = k
b.s = c
b.y = c
b.o = i
j.t = b
j.z = g
j.y = g
j.p = h
assert b.o.y.y.q.p.txt == "
class A:
    def __init__(self, txt: str):
        self.q: D = None
        self.w: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: A = None
        self.s: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: A = None
        self.q: B = None
        self.txt = txt

c = A("c")
k = B("k")
g = C("g")
i = D("i")
h = E("h")
b = C("b")
j = D("j")

c.q = j
c.w = h
k.u = j
k.z = c
k.s = c
g.s = c
g.y = c
g.o = i
i.t = b
i.z = b
i.p = h
i.y = g
h.v = c
h.q = k
b.s = c
b.y = c
b.o = i
j.t = b
j.z = g
j.y = g
j.p = h
assert b.o.y.y.q.p.txt == "h"