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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: C = None
        self.t: D = None
        self.y: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.v: D = None
        self.p: C = None
        self.t: D = None
        self.y: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

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