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

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.t: F = None
        self.s: E = None
        self.o: C = None
        self.w: D = None
        self.r: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: F = None
        self.y: B = None
        self.txt = txt

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

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

a.o = g
l.y = g
l.t = g
l.r = g
l.s = b
l.o = n
l.w = f
n.p = g
n.s = g
n.r = a
n.w = f
f.u = a
b.v = l
b.y = l
b.p = g
g.r = m
g.u = b
g.w = b
g.x = n
m.v = l
m.y = l
m.p = g
assert b.p.x.r.o.x.s.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.y: F = None
        self.t: F = None
        self.s: E = None
        self.o: C = None
        self.w: D = None
        self.r: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.p: F = None
        self.y: B = None
        self.txt = txt

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

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

a.o = g
l.y = g
l.t = g
l.r = g
l.s = b
l.o = n
l.w = f
n.p = g
n.s = g
n.r = a
n.w = f
f.u = a
b.v = l
b.y = l
b.p = g
g.r = m
g.u = b
g.w = b
g.x = n
m.v = l
m.y = l
m.p = g
assert b.p.x.r.o.x.s.txt == "g"