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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: E = None
        self.x: A = None
        self.z: E = None
        self.t: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: D = None
        self.v: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: A = None
        self.o: B = None
        self.p: B = None
        self.y: D = None
        self.txt = txt

b = A("b")
l = B("l")
f = C("f")
d = D("d")
h = E("h")
n = C("n")
g = A("g")

b.p = h
l.u = h
l.p = h
l.z = h
l.x = b
l.t = b
f.z = b
f.t = d
f.v = g
d.s = b
d.p = b
d.o = h
d.t = f
h.s = l
h.o = l
h.p = l
h.x = b
h.y = d
n.z = b
n.v = b
n.t = d
g.p = h
assert g.p.y.o.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.p: E = None
        self.x: A = None
        self.z: E = None
        self.t: A = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.t: D = None
        self.v: A = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: B = None
        self.x: A = None
        self.o: B = None
        self.p: B = None
        self.y: D = None
        self.txt = txt

b = A("b")
l = B("l")
f = C("f")
d = D("d")
h = E("h")
n = C("n")
g = A("g")

b.p = h
l.u = h
l.p = h
l.z = h
l.x = b
l.t = b
f.z = b
f.t = d
f.v = g
d.s = b
d.p = b
d.o = h
d.t = f
h.s = l
h.o = l
h.p = l
h.x = b
h.y = d
n.z = b
n.v = b
n.t = d
g.p = h
assert g.p.y.o.txt == "h"