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

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: D = None
        self.x: A = None
        self.q: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: A = None
        self.u: F = None
        self.p: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: A = None
        self.txt = txt

i = A("i")
n = B("n")
l = C("l")
j = D("j")
b = E("b")
h = F("h")
f = G("f")

i.y = h
i.r = f
n.u = b
n.y = j
n.x = i
n.q = f
l.q = n
l.s = i
l.u = h
l.p = b
j.y = n
j.t = h
j.w = l
j.x = b
b.p = n
b.t = n
b.q = f
b.z = f
b.u = j
b.x = j
b.y = h
h.o = b
f.o = j
f.s = i
assert n.x.y.o.x.t.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: G = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.u: E = None
        self.y: D = None
        self.x: A = None
        self.q: G = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.q: B = None
        self.s: A = None
        self.u: F = None
        self.p: E = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.o: D = None
        self.s: A = None
        self.txt = txt

i = A("i")
n = B("n")
l = C("l")
j = D("j")
b = E("b")
h = F("h")
f = G("f")

i.y = h
i.r = f
n.u = b
n.y = j
n.x = i
n.q = f
l.q = n
l.s = i
l.u = h
l.p = b
j.y = n
j.t = h
j.w = l
j.x = b
b.p = n
b.t = n
b.q = f
b.z = f
b.u = j
b.x = j
b.y = h
h.o = b
f.o = j
f.s = i
assert n.x.y.o.x.t.o.y.txt == "h"