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

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: E = None
        self.p: F = None
        self.x: F = None
        self.z: D = None
        self.txt = txt

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

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

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

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

k = A("k")
i = B("i")
g = C("g")
d = D("d")
l = E("l")
a = F("a")

k.u = i
k.o = l
k.r = d
i.q = d
i.z = d
i.u = l
i.p = a
i.x = a
g.y = d
d.x = l
d.q = l
d.o = k
l.r = g
l.v = k
l.s = k
a.w = d
a.x = l
a.u = l
assert i.p.w.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.o: E = None
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.q: D = None
        self.u: E = None
        self.p: F = None
        self.x: F = None
        self.z: D = None
        self.txt = txt

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

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

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

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

k = A("k")
i = B("i")
g = C("g")
d = D("d")
l = E("l")
a = F("a")

k.u = i
k.o = l
k.r = d
i.q = d
i.z = d
i.u = l
i.p = a
i.x = a
g.y = d
d.x = l
d.q = l
d.o = k
l.r = g
l.v = k
l.s = k
a.w = d
a.x = l
a.u = l
assert i.p.w.x.txt == "l"