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

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

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

j.y = h
h.y = n
h.p = n
h.o = e
h.s = a
e.w = b
a.u = k
a.x = k
a.r = j
a.p = n
a.y = n
a.o = b
n.q = h
n.x = h
n.r = j
n.s = f
n.u = e
l.p = k
f.x = b
b.x = f
k.u = a
k.x = a
k.r = j
k.p = n
k.y = n
k.o = b
assert a.p.x.s.o.x.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.y: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.w: G = None
        self.txt = txt

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

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

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

class G:
    def __init__(self, txt: str):
        self.x: G = None
        self.txt = txt

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

j.y = h
h.y = n
h.p = n
h.o = e
h.s = a
e.w = b
a.u = k
a.x = k
a.r = j
a.p = n
a.y = n
a.o = b
n.q = h
n.x = h
n.r = j
n.s = f
n.u = e
l.p = k
f.x = b
b.x = f
k.u = a
k.x = a
k.r = j
k.p = n
k.y = n
k.o = b
assert a.p.x.s.o.x.x.x.txt == "f"