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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: B = None
        self.u: D = None
        self.s: A = None
        self.txt = txt

c = A("c")
m = B("m")
f = C("f")
n = D("n")
e = E("e")
i = E("i")
b = A("b")

c.p = f
c.t = f
c.r = m
m.q = i
f.t = i
f.u = c
n.u = c
n.v = m
n.w = m
n.z = f
e.y = b
e.s = b
e.w = m
e.u = n
i.y = c
i.w = m
i.u = n
i.s = b
b.p = f
b.t = f
b.r = m
assert b.t.t.y.r.q.txt == "
class A:
    def __init__(self, txt: str):
        self.p: C = None
        self.t: C = None
        self.r: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: A = None
        self.w: B = None
        self.u: D = None
        self.s: A = None
        self.txt = txt

c = A("c")
m = B("m")
f = C("f")
n = D("n")
e = E("e")
i = E("i")
b = A("b")

c.p = f
c.t = f
c.r = m
m.q = i
f.t = i
f.u = c
n.u = c
n.v = m
n.w = m
n.z = f
e.y = b
e.s = b
e.w = m
e.u = n
i.y = c
i.w = m
i.u = n
i.s = b
b.p = f
b.t = f
b.r = m
assert b.t.t.y.r.q.txt == "i"