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

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: A = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.u: D = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: B = None
        self.s: B = None
        self.p: D = None
        self.w: D = None
        self.txt = txt

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

f.s = h
f.r = c
f.x = i
d.v = l
h.r = f
h.o = f
h.p = l
c.q = h
c.x = l
l.s = i
l.u = c
l.x = c
i.z = h
i.u = d
i.s = d
i.p = c
i.w = c
assert h.o.r.x.s.z.p.txt == "
class A:
    def __init__(self, txt: str):
        self.s: C = None
        self.r: D = None
        self.x: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: A = None
        self.o: A = None
        self.p: E = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.s: F = None
        self.u: D = None
        self.x: D = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: B = None
        self.s: B = None
        self.p: D = None
        self.w: D = None
        self.txt = txt

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

f.s = h
f.r = c
f.x = i
d.v = l
h.r = f
h.o = f
h.p = l
c.q = h
c.x = l
l.s = i
l.u = c
l.x = c
i.z = h
i.u = d
i.s = d
i.p = c
i.w = c
assert h.o.r.x.s.z.p.txt == "l"