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

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: B = None
        self.txt = txt

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

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

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

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

j = A("j")
b = B("b")
k = C("k")
n = D("n")
m = E("m")
c = F("c")
e = C("e")
a = B("a")
f = F("f")

j.p = n
j.z = k
b.v = c
b.z = a
k.x = f
k.p = m
n.z = m
m.t = j
m.w = c
m.z = n
c.z = j
c.p = j
c.s = b
c.u = n
e.x = c
e.p = m
a.v = f
a.z = b
f.z = j
f.p = j
f.s = a
f.u = n
assert f.u.z.z.z.z.z.t.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: D = None
        self.z: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.v: F = None
        self.z: B = None
        self.txt = txt

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

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

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

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

j = A("j")
b = B("b")
k = C("k")
n = D("n")
m = E("m")
c = F("c")
e = C("e")
a = B("a")
f = F("f")

j.p = n
j.z = k
b.v = c
b.z = a
k.x = f
k.p = m
n.z = m
m.t = j
m.w = c
m.z = n
c.z = j
c.p = j
c.s = b
c.u = n
e.x = c
e.p = m
a.v = f
a.z = b
f.z = j
f.p = j
f.s = a
f.u = n
assert f.u.z.z.z.z.z.t.p.z.txt == "m"