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

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: A = None
        self.o: D = None
        self.s: A = None
        self.w: D = 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.r: D = None
        self.w: C = None
        self.txt = txt

i = A("i")
j = B("j")
k = C("k")
b = D("b")
c = E("c")
f = A("f")
a = C("a")

i.u = f
i.q = a
j.z = a
j.r = k
k.p = a
k.r = i
k.s = i
k.o = b
k.w = b
b.p = i
c.r = b
c.w = a
f.u = i
f.q = a
a.p = k
a.r = i
a.s = i
a.o = b
a.w = b
assert k.s.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.q: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: A = None
        self.o: D = None
        self.s: A = None
        self.w: D = 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.r: D = None
        self.w: C = None
        self.txt = txt

i = A("i")
j = B("j")
k = C("k")
b = D("b")
c = E("c")
f = A("f")
a = C("a")

i.u = f
i.q = a
j.z = a
j.r = k
k.p = a
k.r = i
k.s = i
k.o = b
k.w = b
b.p = i
c.r = b
c.w = a
f.u = i
f.q = a
a.p = k
a.r = i
a.s = i
a.o = b
a.w = b
assert k.s.u.u.txt == "i"