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

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: D = None
        self.r: A = None
        self.q: A = None
        self.txt = txt

d = A("d")
m = B("m")
f = C("f")
e = D("e")
k = E("k")
n = D("n")
b = E("b")

d.w = f
d.z = k
m.z = b
m.r = b
m.p = f
m.v = f
m.w = f
f.t = b
f.x = k
e.t = d
e.r = m
e.p = b
k.t = m
k.x = n
k.r = d
k.q = d
n.t = d
n.r = m
n.p = k
b.t = m
b.x = n
b.r = d
b.q = d
assert b.r.w.t.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.z: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.t: B = None
        self.x: D = None
        self.r: A = None
        self.q: A = None
        self.txt = txt

d = A("d")
m = B("m")
f = C("f")
e = D("e")
k = E("k")
n = D("n")
b = E("b")

d.w = f
d.z = k
m.z = b
m.r = b
m.p = f
m.v = f
m.w = f
f.t = b
f.x = k
e.t = d
e.r = m
e.p = b
k.t = m
k.x = n
k.r = d
k.q = d
n.t = d
n.r = m
n.p = k
b.t = m
b.x = n
b.r = d
b.q = d
assert b.r.w.t.txt == "b"