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

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
m = D("m")
a = E("a")
l = B("l")
c = A("c")
b = B("b")

g.p = d
g.t = c
g.x = l
g.q = m
f.x = d
f.z = g
d.u = a
m.y = a
m.v = d
a.r = l
a.u = f
a.v = m
l.x = d
l.z = g
c.p = d
c.t = g
c.x = f
c.q = m
b.x = d
b.z = g
assert g.q.v.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: A = None
        self.x: B = None
        self.q: D = None
        self.txt = txt

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

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

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

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

g = A("g")
f = B("f")
d = C("d")
m = D("m")
a = E("a")
l = B("l")
c = A("c")
b = B("b")

g.p = d
g.t = c
g.x = l
g.q = m
f.x = d
f.z = g
d.u = a
m.y = a
m.v = d
a.r = l
a.u = f
a.v = m
l.x = d
l.z = g
c.p = d
c.t = g
c.x = f
c.q = m
b.x = d
b.z = g
assert g.q.v.u.u.txt == "f"