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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: A = None
        self.r: F = None
        self.t: D = None
        self.txt = txt

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

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

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

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

j = A("j")
a = B("a")
m = C("m")
d = D("d")
n = E("n")
k = F("k")
l = C("l")
i = F("i")
h = F("h")
f = B("f")

j.q = m
a.u = d
a.t = d
a.z = j
a.r = k
m.y = n
m.x = l
d.t = n
d.q = f
d.w = j
n.p = d
k.w = n
k.z = i
l.y = n
l.x = m
i.w = n
i.z = h
h.w = n
h.z = k
f.u = d
f.t = d
f.z = j
f.r = h
assert i.z.w.p.w.txt == "
class A:
    def __init__(self, txt: str):
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: A = None
        self.r: F = None
        self.t: D = None
        self.txt = txt

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

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

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

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

j = A("j")
a = B("a")
m = C("m")
d = D("d")
n = E("n")
k = F("k")
l = C("l")
i = F("i")
h = F("h")
f = B("f")

j.q = m
a.u = d
a.t = d
a.z = j
a.r = k
m.y = n
m.x = l
d.t = n
d.q = f
d.w = j
n.p = d
k.w = n
k.z = i
l.y = n
l.x = m
i.w = n
i.z = h
h.w = n
h.z = k
f.u = d
f.t = d
f.z = j
f.r = h
assert i.z.w.p.w.txt == "j"