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

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: D = None
        self.x: E = None
        self.o: E = None
        self.txt = txt

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

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

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

f = A("f")
g = B("g")
l = C("l")
m = D("m")
d = E("d")
h = F("h")
n = C("n")

f.u = h
f.v = g
f.o = l
g.v = f
g.z = m
g.r = m
g.y = d
g.o = d
g.w = n
l.p = h
l.v = m
l.x = d
l.o = d
m.r = h
m.s = n
m.y = l
d.v = m
h.o = m
n.p = h
n.v = m
n.x = d
n.o = d
assert n.x.v.r.txt == "
class A:
    def __init__(self, txt: str):
        self.u: F = None
        self.v: B = None
        self.o: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.p: F = None
        self.v: D = None
        self.x: E = None
        self.o: E = None
        self.txt = txt

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

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

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

f = A("f")
g = B("g")
l = C("l")
m = D("m")
d = E("d")
h = F("h")
n = C("n")

f.u = h
f.v = g
f.o = l
g.v = f
g.z = m
g.r = m
g.y = d
g.o = d
g.w = n
l.p = h
l.v = m
l.x = d
l.o = d
m.r = h
m.s = n
m.y = l
d.v = m
h.o = m
n.p = h
n.v = m
n.x = d
n.o = d
assert n.x.v.r.txt == "h"