class A:
    def __init__(self, txt: str):
        self.p: F = None
        self.q: E = None
        self.y: F = None
        self.w: D = None
        self.r: D = None
        self.x: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: F = None
        self.y: E = None
        self.w: E = None
        self.x: D = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.o: C = None
        self.r: C = None
        self.y: F = None
        self.x: A = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
d = C("d")
n = D("n")
c = E("c")
b = F("b")
i = F("i")

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

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.t: F = None
        self.y: E = None
        self.w: E = None
        self.x: D = None
        self.q: C = None
        self.txt = txt

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

class D:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: E = None
        self.o: C = None
        self.r: C = None
        self.y: F = None
        self.x: A = None
        self.txt = txt

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

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

h = A("h")
f = B("f")
d = C("d")
n = D("n")
c = E("c")
b = F("b")
i = F("i")

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