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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: A = None
        self.y: D = None
        self.t: A = None
        self.txt = txt

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.w: E = None
        self.u: A = None
        self.y: D = None
        self.t: A = None
        self.txt = txt

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

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

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

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