class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: A = None
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.p: A = None
        self.s: F = None
        self.q: A = None
        self.txt = txt

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

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

c.p = n
c.v = n
c.r = k
c.w = a
f.p = h
f.q = h
f.x = h
f.r = n
b.u = a
k.x = n
k.t = h
k.w = a
k.z = b
h.v = a
h.s = a
h.p = c
h.q = c
a.y = f
a.z = b
a.u = b
a.r = n
n.p = c
n.v = c
n.r = k
n.w = a
assert a.u.u.u.u.z.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.v: A = None
        self.r: D = None
        self.w: F = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: F = None
        self.p: A = None
        self.s: F = None
        self.q: A = None
        self.txt = txt

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

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

c.p = n
c.v = n
c.r = k
c.w = a
f.p = h
f.q = h
f.x = h
f.r = n
b.u = a
k.x = n
k.t = h
k.w = a
k.z = b
h.v = a
h.s = a
h.p = c
h.q = c
a.y = f
a.z = b
a.u = b
a.r = n
n.p = c
n.v = c
n.r = k
n.w = a
assert a.u.u.u.u.z.u.r.txt == "n"