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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: A = None
        self.r: E = None
        self.w: E = None
        self.s: A = None
        self.txt = txt

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

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

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

l = A("l")
h = B("h")
i = C("i")
g = D("g")
b = E("b")
k = E("k")
n = E("n")

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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.z: A = None
        self.r: E = None
        self.w: E = None
        self.s: A = None
        self.txt = txt

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

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

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

l = A("l")
h = B("h")
i = C("i")
g = D("g")
b = E("b")
k = E("k")
n = E("n")

l.p = i
h.t = b
h.w = b
h.z = l
h.s = l
h.r = k
i.x = g
i.r = g
g.u = k
b.v = i
b.s = n
b.q = g
k.v = i
k.s = b
k.q = g
n.v = i
n.s = b
n.q = g
assert h.r.v.x.u.q.txt == "g"