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

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

f = A("f")
l = B("l")
i = C("i")
m = D("m")
n = E("n")
g = F("g")
a = E("a")
b = C("b")

f.x = a
f.y = g
f.q = i
l.u = m
l.z = f
l.w = f
i.x = f
i.y = n
m.p = g
n.y = f
n.o = g
g.q = l
a.y = f
a.o = g
b.x = f
b.y = n
assert l.u.p.q.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.y: F = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: D = None
        self.z: A = None
        self.w: A = None
        self.txt = txt

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

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

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

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

f = A("f")
l = B("l")
i = C("i")
m = D("m")
n = E("n")
g = F("g")
a = E("a")
b = C("b")

f.x = a
f.y = g
f.q = i
l.u = m
l.z = f
l.w = f
i.x = f
i.y = n
m.p = g
n.y = f
n.o = g
g.q = l
a.y = f
a.o = g
b.x = f
b.y = n
assert l.u.p.q.u.txt == "m"