class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: B = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

l = A("l")
h = B("h")
a = C("a")
m = D("m")
e = E("e")
d = F("d")

l.x = h
l.s = h
l.q = m
h.t = l
h.v = a
h.u = d
h.x = m
a.v = l
m.o = a
e.w = h
e.y = m
d.r = h
d.v = h
d.t = a
d.q = l
assert m.o.v.s.v.v.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.s: B = None
        self.q: D = None
        self.txt = txt

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

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

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

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

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

l = A("l")
h = B("h")
a = C("a")
m = D("m")
e = E("e")
d = F("d")

l.x = h
l.s = h
l.q = m
h.t = l
h.v = a
h.u = d
h.x = m
a.v = l
m.o = a
e.w = h
e.y = m
d.r = h
d.v = h
d.t = a
d.q = l
assert m.o.v.s.v.v.txt == "l"