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

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

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

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

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

k = A("k")
n = B("n")
h = C("h")
g = D("g")
b = E("b")
d = C("d")
c = A("c")

k.t = c
n.s = k
n.u = b
n.x = h
h.r = g
h.w = g
h.v = c
h.q = b
g.t = d
g.r = n
b.z = k
d.r = g
d.w = g
d.v = k
d.q = b
c.t = k
assert c.t.t.t.txt == "
class A:
    def __init__(self, txt: str):
        self.t: A = None
        self.txt = txt

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

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

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

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

k = A("k")
n = B("n")
h = C("h")
g = D("g")
b = E("b")
d = C("d")
c = A("c")

k.t = c
n.s = k
n.u = b
n.x = h
h.r = g
h.w = g
h.v = c
h.q = b
g.t = d
g.r = n
b.z = k
d.r = g
d.w = g
d.v = k
d.q = b
c.t = k
assert c.t.t.t.txt == "k"