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

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: D = None
        self.v: D = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

j = A("j")
i = B("i")
a = C("a")
g = D("g")
m = E("m")
k = F("k")
f = G("f")
d = D("d")

j.o = k
j.z = k
j.y = i
i.u = k
i.x = d
i.v = d
i.p = j
a.z = d
a.u = i
a.q = k
a.t = m
a.v = m
g.o = a
m.q = g
m.u = g
m.o = i
m.t = j
m.w = d
k.r = m
k.v = d
f.p = a
f.z = i
d.o = a
assert a.u.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.o: F = None
        self.z: F = None
        self.y: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: F = None
        self.x: D = None
        self.v: D = None
        self.p: A = None
        self.txt = txt

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

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

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

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

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

j = A("j")
i = B("i")
a = C("a")
g = D("g")
m = E("m")
k = F("k")
f = G("f")
d = D("d")

j.o = k
j.z = k
j.y = i
i.u = k
i.x = d
i.v = d
i.p = j
a.z = d
a.u = i
a.q = k
a.t = m
a.v = m
g.o = a
m.q = g
m.u = g
m.o = i
m.t = j
m.w = d
k.r = m
k.v = d
f.p = a
f.z = i
d.o = a
assert a.u.p.z.txt == "k"