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

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

class C:
    def __init__(self, txt: str):
        self.z: G = None
        self.w: E = None
        self.y: D = None
        self.r: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

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

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

class C:
    def __init__(self, txt: str):
        self.z: G = None
        self.w: E = None
        self.y: D = None
        self.r: B = None
        self.x: A = None
        self.txt = txt

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

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

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

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

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

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