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

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

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

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

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

g = A("g")
e = B("e")
a = C("a")
j = D("j")
c = E("c")
b = C("b")

g.p = c
g.v = c
g.q = j
e.s = b
e.x = c
e.v = g
e.y = a
a.p = c
a.z = j
j.u = c
c.s = e
c.p = e
c.r = j
b.p = c
b.z = j
assert c.r.u.r.u.p.y.txt == "
class A:
    def __init__(self, txt: str):
        self.p: E = None
        self.v: E = None
        self.q: D = None
        self.txt = txt

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

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

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

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

g = A("g")
e = B("e")
a = C("a")
j = D("j")
c = E("c")
b = C("b")

g.p = c
g.v = c
g.q = j
e.s = b
e.x = c
e.v = g
e.y = a
a.p = c
a.z = j
j.u = c
c.s = e
c.p = e
c.r = j
b.p = c
b.z = j
assert c.r.u.r.u.p.y.txt == "a"