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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

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

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

f.r = n
f.o = m
n.s = c
n.z = c
n.t = f
n.v = m
d.x = n
c.s = m
c.p = f
h.v = d
h.z = d
m.u = n
m.o = h
l.r = n
l.o = m
assert c.p.r.t.o.txt == "m"