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

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

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

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

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

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

d = A("d")
n = B("n")
g = C("g")
l = D("l")
c = E("c")
b = F("b")

d.v = l
d.w = n
n.w = g
n.r = g
n.u = g
n.z = c
g.t = c
g.r = c
g.u = c
g.x = l
g.o = b
g.w = n
l.o = d
l.u = c
l.r = c
c.q = g
c.x = l
c.o = n
b.t = l
b.o = l
b.x = n
b.p = c
assert c.x.u.q.t.q.txt == "
class A:
    def __init__(self, txt: str):
        self.v: D = None
        self.w: B = None
        self.txt = txt

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

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

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

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

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

d = A("d")
n = B("n")
g = C("g")
l = D("l")
c = E("c")
b = F("b")

d.v = l
d.w = n
n.w = g
n.r = g
n.u = g
n.z = c
g.t = c
g.r = c
g.u = c
g.x = l
g.o = b
g.w = n
l.o = d
l.u = c
l.r = c
c.q = g
c.x = l
c.o = n
b.t = l
b.o = l
b.x = n
b.p = c
assert c.x.u.q.t.q.txt == "g"