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

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.r: F = None
        self.q: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.z: B = None
        self.s: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: C = None
        self.y: C = None
        self.s: D = None
        self.z: G = None
        self.txt = txt

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

b = A("b")
m = B("m")
i = C("i")
f = D("f")
e = E("e")
d = F("d")
j = G("j")
c = D("c")

b.u = j
b.w = i
m.w = j
m.q = j
m.r = d
i.u = e
i.w = c
i.v = c
i.p = f
i.z = m
f.z = i
e.w = j
e.s = j
e.z = m
d.o = b
d.u = i
d.y = i
d.s = f
d.z = j
j.p = b
j.y = i
j.q = i
j.x = i
j.r = m
c.z = i
assert j.p.u.p.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.w: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.w: G = None
        self.r: F = None
        self.q: G = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.w: G = None
        self.z: B = None
        self.s: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.o: A = None
        self.u: C = None
        self.y: C = None
        self.s: D = None
        self.z: G = None
        self.txt = txt

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

b = A("b")
m = B("m")
i = C("i")
f = D("f")
e = E("e")
d = F("d")
j = G("j")
c = D("c")

b.u = j
b.w = i
m.w = j
m.q = j
m.r = d
i.u = e
i.w = c
i.v = c
i.p = f
i.z = m
f.z = i
e.w = j
e.s = j
e.z = m
d.o = b
d.u = i
d.y = i
d.s = f
d.z = j
j.p = b
j.y = i
j.q = i
j.x = i
j.r = m
c.z = i
assert j.p.u.p.u.txt == "j"