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

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: E = None
        self.z: E = None
        self.u: B = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: D = None
        self.r: B = None
        self.v: D = None
        self.txt = txt

c = A("c")
h = B("h")
m = C("m")
j = D("j")
g = E("g")

c.p = h
h.s = j
h.v = g
m.t = c
m.s = c
j.v = m
j.t = m
j.s = g
j.z = g
j.u = h
g.x = c
g.w = j
g.v = j
g.r = h
assert j.u.v.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.v: C = None
        self.s: E = None
        self.z: E = None
        self.u: B = None
        self.t: C = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: A = None
        self.w: D = None
        self.r: B = None
        self.v: D = None
        self.txt = txt

c = A("c")
h = B("h")
m = C("m")
j = D("j")
g = E("g")

c.p = h
h.s = j
h.v = g
m.t = c
m.s = c
j.v = m
j.t = m
j.s = g
j.z = g
j.u = h
g.x = c
g.w = j
g.v = j
g.r = h
assert j.u.v.x.p.txt == "h"