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

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

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

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

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

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

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

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

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

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

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

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

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

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

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