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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: A = None
        self.t: F = None
        self.txt = txt

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

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

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

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: C = None
        self.z: A = None
        self.t: F = None
        self.txt = txt

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

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

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