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

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

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

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

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

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

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

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

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

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

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

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

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