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

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: B = None
        self.v: D = None
        self.y: D = None
        self.z: B = None
        self.txt = txt

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

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

k = A("k")
i = B("i")
a = C("a")
m = D("m")
n = E("n")
g = C("g")
b = D("b")
f = A("f")

k.t = b
k.v = b
k.p = n
k.q = f
i.r = m
i.y = m
i.v = f
i.t = g
a.u = g
a.o = i
a.z = i
a.v = m
a.y = m
m.p = k
n.p = b
n.q = f
n.r = f
n.y = m
n.w = a
g.u = a
g.o = i
g.z = i
g.v = b
g.y = m
b.p = f
f.t = m
f.v = m
f.p = n
f.q = k
assert b.p.q.v.p.q.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.p: E = None
        self.q: A = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: C = None
        self.o: B = None
        self.v: D = None
        self.y: D = None
        self.z: B = None
        self.txt = txt

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

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

k = A("k")
i = B("i")
a = C("a")
m = D("m")
n = E("n")
g = C("g")
b = D("b")
f = A("f")

k.t = b
k.v = b
k.p = n
k.q = f
i.r = m
i.y = m
i.v = f
i.t = g
a.u = g
a.o = i
a.z = i
a.v = m
a.y = m
m.p = k
n.p = b
n.q = f
n.r = f
n.y = m
n.w = a
g.u = a
g.o = i
g.z = i
g.v = b
g.y = m
b.p = f
f.t = m
f.v = m
f.p = n
f.q = k
assert b.p.q.v.p.q.txt == "k"