class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.v: A = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: E = None
        self.v: C = None
        self.r: E = None
        self.p: F = None
        self.txt = txt

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

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

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

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

d = A("d")
c = B("c")
l = C("l")
a = D("a")
g = E("g")
m = F("m")
i = A("i")
e = F("e")

d.q = i
d.v = i
d.x = g
d.t = l
c.z = l
c.v = l
c.s = g
c.r = g
c.p = e
l.q = i
a.u = g
a.q = c
a.v = d
a.w = l
g.v = c
g.t = l
g.w = a
m.q = d
m.u = e
m.y = l
m.o = a
i.q = d
i.v = d
i.x = g
i.t = l
e.q = d
e.u = m
e.y = l
e.o = a
assert e.u.o.q.r.txt == "
class A:
    def __init__(self, txt: str):
        self.q: A = None
        self.x: E = None
        self.v: A = None
        self.t: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.z: C = None
        self.s: E = None
        self.v: C = None
        self.r: E = None
        self.p: F = None
        self.txt = txt

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

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

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

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

d = A("d")
c = B("c")
l = C("l")
a = D("a")
g = E("g")
m = F("m")
i = A("i")
e = F("e")

d.q = i
d.v = i
d.x = g
d.t = l
c.z = l
c.v = l
c.s = g
c.r = g
c.p = e
l.q = i
a.u = g
a.q = c
a.v = d
a.w = l
g.v = c
g.t = l
g.w = a
m.q = d
m.u = e
m.y = l
m.o = a
i.q = d
i.v = d
i.x = g
i.t = l
e.q = d
e.u = m
e.y = l
e.o = a
assert e.u.o.q.r.txt == "g"