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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.q: F = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
j = C("j")
b = D("b")
g = E("g")
n = F("n")
k = G("k")
d = B("d")
f = C("f")

c.u = k
c.p = g
c.o = b
c.w = b
a.x = j
j.x = n
j.z = n
j.w = c
b.u = a
b.v = g
b.t = g
b.w = j
b.o = c
g.y = k
g.q = n
n.o = c
n.u = c
n.p = j
k.u = c
k.t = d
d.x = j
f.x = n
f.z = n
f.w = c
assert f.z.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.u: G = None
        self.p: E = None
        self.o: D = None
        self.w: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: G = None
        self.q: F = None
        self.txt = txt

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

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

c = A("c")
a = B("a")
j = C("j")
b = D("b")
g = E("g")
n = F("n")
k = G("k")
d = B("d")
f = C("f")

c.u = k
c.p = g
c.o = b
c.w = b
a.x = j
j.x = n
j.z = n
j.w = c
b.u = a
b.v = g
b.t = g
b.w = j
b.o = c
g.y = k
g.q = n
n.o = c
n.u = c
n.p = j
k.u = c
k.t = d
d.x = j
f.x = n
f.z = n
f.w = c
assert f.z.o.p.txt == "g"