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

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: D = None
        self.u: C = None
        self.x: E = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: D = None
        self.txt = txt

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

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

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

i = A("i")
c = B("c")
d = C("d")
j = D("j")
g = E("g")
k = F("k")
n = A("n")

i.x = g
i.o = k
c.t = g
c.x = g
c.y = j
c.o = j
c.u = d
d.r = c
d.z = j
j.q = k
j.w = g
g.z = j
g.o = c
g.r = d
g.y = n
k.s = j
n.x = g
n.o = k
assert k.s.w.o.x.txt == "
class A:
    def __init__(self, txt: str):
        self.x: E = None
        self.o: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.t: E = None
        self.y: D = None
        self.u: C = None
        self.x: E = None
        self.o: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.r: B = None
        self.z: D = None
        self.txt = txt

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

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

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

i = A("i")
c = B("c")
d = C("d")
j = D("j")
g = E("g")
k = F("k")
n = A("n")

i.x = g
i.o = k
c.t = g
c.x = g
c.y = j
c.o = j
c.u = d
d.r = c
d.z = j
j.q = k
j.w = g
g.z = j
g.o = c
g.r = d
g.y = n
k.s = j
n.x = g
n.o = k
assert k.s.w.o.x.txt == "g"