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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: F = None
        self.o: F = None
        self.s: A = None
        self.w: E = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: B = None
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: C = None
        self.u: A = None
        self.z: B = None
        self.txt = txt

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

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

class B:
    def __init__(self, txt: str):
        self.t: D = None
        self.q: F = None
        self.o: F = None
        self.s: A = None
        self.w: E = None
        self.x: F = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.z: A = None
        self.q: B = None
        self.s: A = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.q: E = None
        self.s: C = None
        self.u: A = None
        self.z: B = None
        self.txt = txt

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

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