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

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: B = None
        self.p: D = None
        self.x: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: C = None
        self.x: C = None
        self.s: B = None
        self.txt = txt

c = A("c")
g = B("g")
a = C("a")
h = D("h")
e = E("e")
k = F("k")
l = D("l")

c.v = a
g.y = c
g.r = c
g.p = e
g.z = k
a.t = k
a.x = k
a.r = g
a.p = l
h.u = a
h.t = g
h.v = e
h.z = c
e.u = a
e.v = c
e.t = k
k.r = h
k.p = a
k.x = a
k.s = g
l.u = a
l.t = g
l.v = e
l.z = c
assert l.z.v.r.p.t.x.r.txt == "
class A:
    def __init__(self, txt: str):
        self.v: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.t: F = None
        self.r: B = None
        self.p: D = None
        self.x: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.r: D = None
        self.p: C = None
        self.x: C = None
        self.s: B = None
        self.txt = txt

c = A("c")
g = B("g")
a = C("a")
h = D("h")
e = E("e")
k = F("k")
l = D("l")

c.v = a
g.y = c
g.r = c
g.p = e
g.z = k
a.t = k
a.x = k
a.r = g
a.p = l
h.u = a
h.t = g
h.v = e
h.z = c
e.u = a
e.v = c
e.t = k
k.r = h
k.p = a
k.x = a
k.s = g
l.u = a
l.t = g
l.v = e
l.z = c
assert l.z.v.r.p.t.x.r.txt == "g"