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

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: E = None
        self.r: D = None
        self.y: D = None
        self.u: C = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
h = C("h")
l = D("l")
e = E("e")
j = C("j")
a = B("a")
c = E("c")

g.x = a
n.q = g
h.x = e
h.p = c
h.r = l
h.y = l
h.u = j
l.t = a
e.u = l
e.t = l
j.x = c
j.p = e
j.r = l
j.y = l
j.u = h
a.q = g
c.u = l
c.t = l
assert e.t.t.q.x.q.x.q.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: E = None
        self.p: E = None
        self.r: D = None
        self.y: D = None
        self.u: C = None
        self.txt = txt

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

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

g = A("g")
n = B("n")
h = C("h")
l = D("l")
e = E("e")
j = C("j")
a = B("a")
c = E("c")

g.x = a
n.q = g
h.x = e
h.p = c
h.r = l
h.y = l
h.u = j
l.t = a
e.u = l
e.t = l
j.x = c
j.p = e
j.r = l
j.y = l
j.u = h
a.q = g
c.u = l
c.t = l
assert e.t.t.q.x.q.x.q.x.txt == "a"