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

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

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

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

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

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

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

j.v = a
j.z = c
j.o = c
n.r = j
n.y = j
d.r = c
a.w = j
a.r = n
a.q = n
a.v = n
a.x = c
a.p = d
m.o = a
c.v = n
c.r = n
c.u = d
c.o = d
c.z = a
f.o = a
assert a.p.r.z.w.v.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: F = None
        self.o: F = None
        self.txt = txt

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

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

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

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

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

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

j.v = a
j.z = c
j.o = c
n.r = j
n.y = j
d.r = c
a.w = j
a.r = n
a.q = n
a.v = n
a.x = c
a.p = d
m.o = a
c.v = n
c.r = n
c.u = d
c.o = d
c.z = a
f.o = a
assert a.p.r.z.w.v.txt == "a"