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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: B = None
        self.s: E = None
        self.y: B = None
        self.txt = txt

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

k = A("k")
c = B("c")
l = C("l")
i = D("i")
m = E("m")
b = C("b")
e = D("e")
j = B("j")
f = A("f")

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

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

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

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.r: B = None
        self.s: E = None
        self.y: B = None
        self.txt = txt

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

k = A("k")
c = B("c")
l = C("l")
i = D("i")
m = E("m")
b = C("b")
e = D("e")
j = B("j")
f = A("f")

k.y = l
c.x = b
c.w = f
c.q = l
l.z = m
l.u = m
i.p = l
i.r = c
i.y = c
i.s = m
m.p = c
m.v = j
b.z = m
b.u = m
e.p = l
e.r = c
e.s = m
e.y = j
j.x = b
j.w = k
j.q = l
f.y = b
assert i.p.u.p.w.txt == "f"