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

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: B = None
        self.r: A = None
        self.z: D = None
        self.u: A = None
        self.txt = txt

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

c = A("c")
h = B("h")
d = C("d")
g = D("g")
k = E("k")
j = A("j")
f = A("f")
n = D("n")
m = E("m")
l = B("l")

c.q = h
h.x = d
h.r = l
h.q = c
h.u = j
d.u = g
d.x = m
d.v = n
d.t = n
d.r = k
g.t = c
g.r = c
g.q = h
g.z = n
g.u = f
k.y = m
k.z = m
j.q = l
f.q = l
n.t = c
n.u = c
n.q = l
n.r = j
n.z = g
m.y = k
m.z = k
l.x = d
l.r = h
l.q = j
l.u = f
assert j.q.q.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.q: B = None
        self.r: A = None
        self.z: D = None
        self.u: A = None
        self.txt = txt

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

c = A("c")
h = B("h")
d = C("d")
g = D("g")
k = E("k")
j = A("j")
f = A("f")
n = D("n")
m = E("m")
l = B("l")

c.q = h
h.x = d
h.r = l
h.q = c
h.u = j
d.u = g
d.x = m
d.v = n
d.t = n
d.r = k
g.t = c
g.r = c
g.q = h
g.z = n
g.u = f
k.y = m
k.z = m
j.q = l
f.q = l
n.t = c
n.u = c
n.q = l
n.r = j
n.z = g
m.y = k
m.z = k
l.x = d
l.r = h
l.q = j
l.u = f
assert j.q.q.q.r.txt == "h"