class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: E = None
        self.z: F = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.r: D = None
        self.o: C = None
        self.txt = txt

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

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

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

f = A("f")
a = B("a")
b = C("b")
n = D("n")
l = E("l")
j = F("j")
e = A("e")
h = C("h")

f.p = e
f.y = l
f.z = j
f.v = n
a.t = l
b.z = a
b.v = a
b.r = n
b.o = h
n.x = l
n.r = e
n.z = j
n.q = f
l.x = h
l.q = j
j.u = e
e.p = f
e.y = l
e.z = j
e.v = n
h.z = a
h.v = a
h.r = n
h.o = b
assert n.r.y.x.o.r.q.z.txt == "
class A:
    def __init__(self, txt: str):
        self.p: A = None
        self.y: E = None
        self.z: F = None
        self.v: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: B = None
        self.v: B = None
        self.r: D = None
        self.o: C = None
        self.txt = txt

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

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

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

f = A("f")
a = B("a")
b = C("b")
n = D("n")
l = E("l")
j = F("j")
e = A("e")
h = C("h")

f.p = e
f.y = l
f.z = j
f.v = n
a.t = l
b.z = a
b.v = a
b.r = n
b.o = h
n.x = l
n.r = e
n.z = j
n.q = f
l.x = h
l.q = j
j.u = e
e.p = f
e.y = l
e.z = j
e.v = n
h.z = a
h.v = a
h.r = n
h.o = b
assert n.r.y.x.o.r.q.z.txt == "j"