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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.r: F = None
        self.o: C = None
        self.u: C = None
        self.x: G = 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.r: E = None
        self.p: D = None
        self.y: B = None
        self.s: B = None
        self.z: C = None
        self.txt = txt

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

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

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

class C:
    def __init__(self, txt: str):
        self.t: B = None
        self.txt = txt

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.r: F = None
        self.o: C = None
        self.u: C = None
        self.x: G = 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.r: E = None
        self.p: D = None
        self.y: B = None
        self.s: B = None
        self.z: C = None
        self.txt = txt

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

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