class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: C = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: C = None
        self.q: B = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.o: G = None
        self.s: G = None
        self.x: C = None
        self.txt = txt

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

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

j.w = g
j.r = g
j.o = a
j.z = d
a.p = b
g.q = j
g.r = a
g.p = c
f.x = d
k.z = f
k.x = g
k.q = a
k.t = a
b.z = k
b.o = m
b.s = m
b.x = g
m.u = a
m.p = a
m.t = c
c.z = f
c.x = g
c.q = a
c.t = a
d.w = g
d.r = g
d.o = a
d.z = j
assert k.t.p.o.t.x.q.o.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: C = None
        self.r: C = None
        self.o: B = None
        self.z: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.z: D = None
        self.x: C = None
        self.q: B = None
        self.t: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: E = None
        self.o: G = None
        self.s: G = None
        self.x: C = None
        self.txt = txt

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

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

j.w = g
j.r = g
j.o = a
j.z = d
a.p = b
g.q = j
g.r = a
g.p = c
f.x = d
k.z = f
k.x = g
k.q = a
k.t = a
b.z = k
b.o = m
b.s = m
b.x = g
m.u = a
m.p = a
m.t = c
c.z = f
c.x = g
c.q = a
c.t = a
d.w = g
d.r = g
d.o = a
d.z = j
assert k.t.p.o.t.x.q.o.p.txt == "b"