class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: E = None
        self.q: B = None
        self.txt = txt

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

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

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

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

g = A("g")
i = B("i")
d = C("d")
j = D("j")
n = E("n")
c = A("c")

g.t = j
g.y = n
g.q = i
i.y = j
d.v = j
d.r = j
d.p = j
d.q = i
d.x = n
j.w = c
j.s = d
j.p = g
j.q = g
j.x = g
n.v = i
c.t = j
c.y = n
c.q = i
assert g.t.s.x.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.y: E = None
        self.q: B = None
        self.txt = txt

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

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

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

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

g = A("g")
i = B("i")
d = C("d")
j = D("j")
n = E("n")
c = A("c")

g.t = j
g.y = n
g.q = i
i.y = j
d.v = j
d.r = j
d.p = j
d.q = i
d.x = n
j.w = c
j.s = d
j.p = g
j.q = g
j.x = g
n.v = i
c.t = j
c.y = n
c.q = i
assert g.t.s.x.txt == "n"