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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: B = None
        self.x: C = None
        self.o: D = None
        self.w: A = None
        self.txt = txt

d = A("d")
m = B("m")
l = C("l")
b = D("b")
h = E("h")

d.v = l
d.z = h
m.x = l
m.t = d
m.z = h
m.q = h
l.p = b
b.u = m
h.q = d
h.w = d
h.u = m
h.x = l
h.o = b
assert b.u.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.z: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.u: B = None
        self.x: C = None
        self.o: D = None
        self.w: A = None
        self.txt = txt

d = A("d")
m = B("m")
l = C("l")
b = D("b")
h = E("h")

d.v = l
d.z = h
m.x = l
m.t = d
m.z = h
m.q = h
l.p = b
b.u = m
h.q = d
h.w = d
h.u = m
h.x = l
h.o = b
assert b.u.x.p.txt == "b"