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

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

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

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

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

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

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

h.p = f
h.x = k
a.o = k
a.z = l
a.w = c
i.q = l
i.r = h
c.v = d
d.z = f
k.s = h
k.w = i
k.r = i
k.p = c
k.x = l
k.v = f
n.z = f
j.o = l
j.z = l
j.w = c
f.o = k
f.z = l
f.w = c
l.s = h
l.w = i
l.r = i
l.p = c
l.x = k
l.v = a
assert c.v.z.w.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: B = None
        self.x: F = None
        self.txt = txt

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

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

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

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

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

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

h.p = f
h.x = k
a.o = k
a.z = l
a.w = c
i.q = l
i.r = h
c.v = d
d.z = f
k.s = h
k.w = i
k.r = i
k.p = c
k.x = l
k.v = f
n.z = f
j.o = l
j.z = l
j.w = c
f.o = k
f.z = l
f.w = c
l.s = h
l.w = i
l.r = i
l.p = c
l.x = k
l.v = a
assert c.v.z.w.v.z.txt == "f"