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

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.txt = txt

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

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

i = A("i")
d = B("d")
f = C("f")
b = D("b")
a = E("a")
g = F("g")
e = G("e")

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: E = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.x: B = None
        self.v: C = None
        self.txt = txt

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

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

i = A("i")
d = B("d")
f = C("f")
b = D("b")
a = E("a")
g = F("g")
e = G("e")

i.p = g
d.y = e
d.q = e
d.r = e
d.t = f
d.p = a
d.u = a
d.s = g
f.z = b
f.u = a
b.y = a
a.x = d
a.v = f
g.p = a
g.o = i
g.t = i
g.u = d
g.r = f
g.x = b
e.o = g
e.t = g
e.p = a
assert b.y.v.z.y.v.u.v.txt == "f"