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

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: C = None
        self.txt = txt

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

d.r = h
h.v = d
h.z = i
h.r = i
h.y = i
i.u = h
i.y = f
a.r = i
a.x = n
a.y = f
f.o = a
f.z = a
f.x = i
f.t = i
f.v = h
n.t = a
n.o = i
assert f.o.r.y.z.y.v.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.u: B = None
        self.y: E = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.t: D = None
        self.o: C = None
        self.txt = txt

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

d.r = h
h.v = d
h.z = i
h.r = i
h.y = i
i.u = h
i.y = f
a.r = i
a.x = n
a.y = f
f.o = a
f.z = a
f.x = i
f.t = i
f.v = h
n.t = a
n.o = i
assert f.o.r.y.z.y.v.txt == "h"